package git.determinal.template.view;




import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.mysql.cj.util.StringUtils;
import io.swagger.annotations.ApiModel;

@ApiModel("Match查询条件参数")
@JsonInclude(Include.ALWAYS)
public class MatchField {
    private String field;
    private Object value;
    private String fieldType;
    private String matchType;
    private String sortType;

    public MatchField of(String field, Object value, MatchType matchType, OrderType orderType) {
        MatchField matchField = new MatchField();
        matchField.setField(field);
        matchField.setValue(value);
        matchField.setMatchType(matchType.getValue());
        matchField.setSortType(orderType.getValue());
        return matchField;
    }

    public OrderField getOrderField() {
        if (StringUtils.isNullOrEmpty(this.sortType)) {
            return null;
        } else {
            OrderField orderField = new OrderField();
            orderField.setField(this.field);
            orderField.setSort(this.sortType);
            return orderField;
        }
    }

    public String getField() {
        return this.field;
    }

    public Object getValue() {
        return this.value;
    }

    public String getFieldType() {
        return this.fieldType;
    }

    public String getMatchType() {
        return this.matchType;
    }

    public String getSortType() {
        return this.sortType;
    }

    public void setField(final String field) {
        this.field = field;
    }

    public void setValue(final Object value) {
        this.value = value;
    }

    public void setFieldType(final String fieldType) {
        this.fieldType = fieldType;
    }

    public void setMatchType(final String matchType) {
        this.matchType = matchType;
    }

    public void setSortType(final String sortType) {
        this.sortType = sortType;
    }

    public boolean equals(final Object o) {
        if (o == this) {
            return true;
        } else if (!(o instanceof MatchField)) {
            return false;
        } else {
            MatchField other = (MatchField)o;
            if (!other.canEqual(this)) {
                return false;
            } else {
                label71: {
                    Object this$field = this.getField();
                    Object other$field = other.getField();
                    if (this$field == null) {
                        if (other$field == null) {
                            break label71;
                        }
                    } else if (this$field.equals(other$field)) {
                        break label71;
                    }

                    return false;
                }

                Object this$value = this.getValue();
                Object other$value = other.getValue();
                if (this$value == null) {
                    if (other$value != null) {
                        return false;
                    }
                } else if (!this$value.equals(other$value)) {
                    return false;
                }

                label57: {
                    Object this$fieldType = this.getFieldType();
                    Object other$fieldType = other.getFieldType();
                    if (this$fieldType == null) {
                        if (other$fieldType == null) {
                            break label57;
                        }
                    } else if (this$fieldType.equals(other$fieldType)) {
                        break label57;
                    }

                    return false;
                }

                Object this$matchType = this.getMatchType();
                Object other$matchType = other.getMatchType();
                if (this$matchType == null) {
                    if (other$matchType != null) {
                        return false;
                    }
                } else if (!this$matchType.equals(other$matchType)) {
                    return false;
                }

                Object this$sortType = this.getSortType();
                Object other$sortType = other.getSortType();
                if (this$sortType == null) {
                    if (other$sortType == null) {
                        return true;
                    }
                } else if (this$sortType.equals(other$sortType)) {
                    return true;
                }

                return false;
            }
        }
    }

    protected boolean canEqual(final Object other) {
        return other instanceof MatchField;
    }

    public int hashCode() {
        boolean PRIME = true;
        int result = 1;
        Object $field = this.getField();
        result = result * 59 + ($field == null ? 43 : $field.hashCode());
        Object $value = this.getValue();
        result = result * 59 + ($value == null ? 43 : $value.hashCode());
        Object $fieldType = this.getFieldType();
        result = result * 59 + ($fieldType == null ? 43 : $fieldType.hashCode());
        Object $matchType = this.getMatchType();
        result = result * 59 + ($matchType == null ? 43 : $matchType.hashCode());
        Object $sortType = this.getSortType();
        result = result * 59 + ($sortType == null ? 43 : $sortType.hashCode());
        return result;
    }

    public String toString() {
        return "MatchField(field=" + this.getField() + ", value=" + this.getValue() + ", fieldType=" + this.getFieldType() + ", matchType=" + this.getMatchType() + ", sortType=" + this.getSortType() + ")";
    }

    public MatchField(final String field, final Object value, final String fieldType, final String matchType, final String sortType) {
        this.field = field;
        this.value = value;
        this.fieldType = fieldType;
        this.matchType = matchType;
        this.sortType = sortType;
    }

    public MatchField() {
    }
}
